<%
'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: info@asp126.com  asp126@qq.com
' Web: http://www.asp126.com , http://www.ude.com.cn
' Copyright (C) 2004 Asp126.com All Rights Reserved.
'****************************************************

dim fso_sys_var
fso_sys_var="script"&"ing.file"&"sys"&"tem"&"object"

function code_fso(strers,ft1,ft2)
  if var_null(strers)="" then
    code_fso=""
    exit function
  end if
  dim strer
  strer=trim(strers)
  strer=replace(strer,"""","\""")
  if ft2=1 then
    strer=replace(strer,":","")
    strer=replace(strer,"|","")
  end if
  select case ft1
  case 1
    strer=replace(strer,vbcrlf,"<br>")
  end select
  code_fso=strer
end function

function file_trim_vbcrlf(fvar)
  dim temp1,tmp,tmpvar
  temp1=fvar
  tmp=false
  do while not tmp
    tmpvar=left(temp1,1)
    if tmpvar=chr(10) or tmpvar=chr(13) then
      temp1=right(temp1,len(temp1)-1)
    else
      tmp=true
    end if
  loop
  tmp=false
  do while not tmp
    tmpvar=right(temp1,1)
    if tmpvar=chr(10) or tmpvar=chr(13) then
      temp1=left(temp1,len(temp1)-1)
    else
      tmp=true
    end if
  loop
  file_trim_vbcrlf=temp1
end function

sub del_file(fname,ftype)
  'on error resume next
  dim fobj,file_name,upload_path
  if len(fname)<3 then exit sub
  if int(instr(fname,"://"))>0 then exit sub
  upload_path=web_dim(13)
  if right(upload_path,1)<>"/" then upload_path=upload_path&"/"
  select case ftype
  case 0
    file_name=web_dim(6)&"style/"&fname
  case 1
    upload_path=web_dim(13)
    if right(upload_path,1)<>"/" then upload_path=upload_path&"/"
    file_name=upload_path&fname
  case 5
    file_name=fname
  case else
    exit sub
  end select
  file_name=server.mappath(file_name)
  set fobj=createobject(fso_sys_var)
  if fobj.fileexists(file_name) then
    fobj.deletefile(file_name)
  end if
  set fobj=nothing
end sub

function get_file(file_name)
  dim filetemp,fileos,filepath
  set fileos=createobject(fso_sys_var)
  filepath=server.mappath(file_name)
  set filetemp=fileos.opentextfile(filepath,1,true)
  get_file=filetemp.ReadAll
  filetemp.close
  set filetemp=nothing
  set fileos=nothing
end function

sub create_file(file_name,filetype)
  dim filetemp,fileos,filepath
  set fileos=createobject(fso_sys_var)
  filepath=server.mappath(file_name)
  set filetemp=fileos.createtextfile(filepath,true)
  filetemp.writeline( filetype )
  filetemp.close
  set filetemp=nothing
  set fileos=nothing
end sub


sub makenewsdir(foldername)
  dim folderos,fileos,myfolder
  set fileos=createobject(fso_sys_var)
  if foldername<>"" then
    myfolder=server.mappath(foldername)
    if not fileos.folderexists(myfolder) then
      set folderos=fileos.createfolder(myfolder)
    end if
  end if
  set fileos=nothing
end sub

'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: info@asp126.com  asp126@qq.com
' Web: http://www.asp126.com , http://www.ude.com.cn
' Copyright (C) 2004 Asp126.com All Rights Reserved.
'****************************************************
%>